<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--<%@taglib prefix="wetechfn" uri="/WEB-INF/tlds/wetech-functions.tld" %>--%>
<%@taglib prefix="fns" uri="/WEB-INF/tlds/fns.tld" %>
<%@ taglib prefix="shiro" uri="/WEB-INF/tlds/shiros.tld" %>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<!-- Content Header (Page header) -->
<section class="content-header" style="">
    <h1>
        休眠户
        <small>休眠户核页面</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
        <li><a href="#">休眠户审核</a></li>
        <li class="active">休眠户审核</li>
    </ol>
</section>

<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-body">
                    <table id="table"></table>
                </div>
            </div>
        </div>

    </div>
</section>

<!-- check Modal -->
<div class="modal fade" id="passModal" tabindex="-1" role="dialog" aria-labelledby="passModalLabel"
        >
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="addModalLabel">申请返回档案库</h4>
            </div>
            <div class="modal-body">
                <form id="passForm" enctype="multipart/form-data">
                    <input type="hidden" id="compay_id" name="id" readonly required>
                    <input type="hidden" id="status" name="operateType" readonly required>

                    <div class="form-group">
                        <label class="control-label"><span class="asterisk">*</span>理由</label>
                        <textarea autofocus id="com_name" class="form-control" name="remark" placeholder="申请返回档案库理由"
                                  minlength="1" required/>

                        <div class="help-block with-errors"></div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="submit" form="passForm" class="btn btn-primary"
                        data-action="{type:'submit',form:'#passForm',url:'<%=request.getContextPath()%>/dormant/checkStatus',after:'$.myAction.refreshTable'}">
                    确定
                </button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="noPassModal" tabindex="-1" role="dialog" aria-labelledby="noPassSmallModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="noPassSmallModalLabel">审核驳回</h4>
            </div>
            <div class="modal-body">
                <form id="noPassForm" enctype="multipart/form-data">
                    <input type="hidden" id="no_id" name="id" readonly required>
                    <input type="hidden" id="no_status" name="operateType" readonly required>

                    <div class="form-group">
                        <label class="control-label"><span class="asterisk">*</span>评审意见</label>
                        <textarea autofocus class="form-control" name="remark" placeholder="评审意见"
                                  minlength="1" required/>

                        <div class="help-block with-errors"></div>
                    </div>
                </form>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" form="noPassForm" class="btn btn-primary"
                        data-action="{type:'submit',form:'#noPassForm',url:'<%=request.getContextPath()%>/fileCheck/checkStatus',after:'$.myAction.refreshTable'}">
                    确定
                </button>
            </div>
        </div>
    </div>
</div>

<script>

    function loadHref(s) {
        $.myAdmin.loadContent(s);
    }

    var $table = $('#table');

    $(function () {
        $table.bootstrapTable({
            url: path + '/dormant/queryByStatusRiskCheck',
            idField: 'id',
            searchOnEnterKey: true,
            showColumns: false,
            detailView: false,
            columns: [
                {field: 'id', title: '编号'},
                {field: 'comName', title: '企业名称'},
                /*{field: 'businessCode', title: '营业执照'},
                 {field: 'creditLine', title: '授信额度'},*/
                {
                    field: 'comType', title: '类别', formatter: function (value, row, index) {
                    if (value == 1) {
                        return "核心企业"
                    } else if (value == 2) {
                        return "一般企业"
                    } else if (value == 3) {
                        return "个人"
                    } else if (value == 4) {
                        return "其他"
                    }
                }
                },
                {
                    field: 'businessType', title: '业务品种', formatter: function (value, row, index) {
                    if (value == 1) {
                        return "供应链融资"
                    } else if (value == 2) {
                        return "企业经营贷"
                    } else if (value == 3) {
                        return "个人借款"
                    }
                }
                },
                {field: 'inputTime', title: '录入时间'},
                {field: 'activeTime', title: '激活时间'},
                {field: 'upTime', title: '上线时间'},
               /* {field: 'supportId', title: '担保方信息'},*/
                {
                    field: 'action',
                    title: '操作',
                    halign: 'center',
                    align: 'center',
                    formatter: 'actionFormatter',
                    events: 'actionEvents',
                    clickToSelect: false
                }
            ]
        });
    });
    //参数传递
    function Search() {
        var temp = {
            datetime: $("#nowdate").val()
        };
        return temp;
    }
    // 数据表格展开内容
    function detailFormatter(index, row) {
        var html = [];
        $.each(row, function (key, value) {
            html.push('<p><b>' + key + ':</b> ' + value + '</p>');
        });
        return html.join('');
    }
    function actionFormatter(value, row, index) {
        str = '\
        <!--<button id="detail_id" class="btn btn-info" type="button" >资料审核</button>-->　\
        ';
        str += '\
            <button class="detail ml10 btn btn-primary" >详情</button>　\
        ';
        str += '\
            <button class="dormanyhistory ml10 btn btn-primary" data-toggle="tooltip" >查看休眠原因</button>　\
            ';
        if (row.dormant == 3) {
            str += '\
        <button id="pass" class="btn btn-success" type="button" >返回档案库</button>　\
        ';
        }

        return str;
    }

    window.actionEvents = {
        'click .detail': function (e, value, row, index) {
            var id = row.id
            $.myAdmin.loadContent('#dormant/dataUpload?id=' + id + '');
        },
        'click #pass': function (e, value, row, index) {
            $('#passModal').modal('show');
            $('#compay_id').val(row.id);
            $('#status').val('10');
        },
        'click .dormanyhistory': function (e, value, row, index) {
            var id = row.id
            $.myAdmin.loadContent('#dormant/historyLoad?id=' + id + '');
        }
    }
    ;

    var setting = {
        view: {
            dblClickExpand: false
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            onClick: onClick
        }
    };

</script>